#ifndef _ASYNCTCPLISTENSOCKIMPL_H_
#define _ASYNCTCPLISTENSOCKIMPL_H_

#include "stdafx.h"

class CTcpListenSocketImpl :		public	ITcpListen,
									public	CUnknownImp,
									public	IoTcpAccpet
{
public:
	CTcpListenSocketImpl(void);
	virtual ~CTcpListenSocketImpl(void);
	
	BEGIN_STDCOM_MAP
		STDCOM_INTERFACE_ENTRY(ITcpListen)
		STDCOM_INTERFACE_ENTRY_UNKNOWN_(ITcpListen)
	END_STDCOM_MAP



	//IIoDevice
	std_method(CloseIo)(UINT rw);
	std_method(BindIo)();
	std_method(OpenIo)();

	//ISocket
	std_method(CreateSock)();
	std_method(CloseSock)();
	std_method(IsOpen)();
	std_method(AttachSock)(_sock_t sock);
	std_method_(_sock_t, DetachSock)();
	std_method(SetOption)(LPCSTR opt, int val);
	std_method(GetOption)(LPCSTR opt, int* val);

	//IListen
	std_method(Listen)(NET_ADDR addr, NET_PORT port);
	std_method(Accept)(IBase* pBase);

	//ITcpListen
	std_method(BindAccept)(IBase* pAccept);
	std_method(UnBindAccpet)();

public:
	void AcceptCB(void *data, event_id error_code, _sock_t s);
private:
	_sock_t								m_sock;
	AcceptListenPtr					m_accept;

};

#endif
